package Process;

/**
 * CalculatingProcess.
 * 
 * @author Stephen Amos, Zach Turk, Dickson Kwong
 *
 */

public class CalculatingProcess extends Process
{
	int calculation = 0;

	public CalculatingProcess(int the_id, SysCall[] the_requests, int the_counter) 
	{
		super(the_id, the_requests, the_counter);
		
		for (int i = 0; i < Math.floor(requests.length/2); i++)
		{
			requests[(int) Math.floor(Math.random() * requests.length)] = SysCall.IDLE;
		}

	}
	
	public CalculatingProcess(int the_id, SysCall[] the_requests) {
		this(the_id, the_requests, 0);
	}

	public void run()
	{
		calculation++;
	}
	
	public SysCall next()
	{
		run();
		
		return super.next();
	}
	
	public String toString() {
		return this.getClass().toString();
	}
}

